package main.java.com.yc.navy.snacknet.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yc.navy.snacknet.bean.CartInfo;
import com.yc.navy.snacknet.bean.CartInfoDTO;
import com.yc.navy.snacknet.mapper.ICartInfoMapper;
import com.yc.navy.snacknet.service.ICartInfoService;
import com.yc.navy.snacknet.util.StringUtil;

@Service
public class CartInfoServiceImpl implements ICartInfoService{
	
	@Autowired
	private ICartInfoMapper cartInfoMapper;

	@Override
	public int add(CartInfo cf) {
		if(StringUtil.checkNull(cf.getCno(), cf.getPno(), cf.getNum(), cf.getMno())) {
			return -100;
		}
		return cartInfoMapper.add(cf);
	}

	@Override
	public List<CartInfo> findByMno(Long mno) {
		return cartInfoMapper.findByMno(mno);
	}

	@Override
	public int delete(String[] cnos) {
		return cartInfoMapper.delete(cnos);
	}

	@Override
	public int deleteByCno(String cno) {
		return cartInfoMapper.deleteByCno(cno);
	}

	@Override
	public int update(CartInfo cf) {
		if(StringUtil.checkNull(cf.getCno(), cf.getNum())) {
			return -100;
		}
		return cartInfoMapper.update(cf);
	}

	@Override
	public List<CartInfoDTO> finds(Long mno) {
		return cartInfoMapper.finds(mno);
	}

	@Override
	public List<CartInfoDTO> findByCnos(String[] cnos) {
		return cartInfoMapper.findByCnos(cnos);
	}

}
